clear
use ReplicationData.dta



*Table 1*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id) irr
eststo clear

*Table 2*

label var MIDs_notlvl1_strong "MIDs initiated against weaker petrostates (2+)"
label var MIDs_45_strong "MIDs initiated against weaker petrostates (4+)"
label var MIDs_notlvl1_strong2 "MIDs initiated against weaker petrostates (2+)"
label var MIDs_45_strong2 "MIDs initiated against weaker petrostates (4+)"
label var MIDs_notlvl1_strong5 "MIDs initiated against weaker petrostates (2+)"
label var MIDs_45_strong5 "MIDs initiated against weaker petrostates (4+)"
label var MIDs_notlvl1_strong10 "MIDs initiated against weaker petrostates (2+)"
label var MIDs_45_strong10 "MIDs initiated against weaker petrostates (4+)"

gen MIDs_petrotarget_notlvl1_bin = 0 if MIDs_petrotarget_init_notlvl1 != .
gen MIDs_petrotarget_45_bin = 0 if MIDs_petrotarget_init_45 != .
replace MIDs_petrotarget_notlvl1_bin = 1 if MIDs_petrotarget_init_notlvl1 != . & MIDs_petrotarget_init_notlvl1 > 0
replace MIDs_petrotarget_45_bin = 1 if MIDs_petrotarget_init_45 != . & MIDs_petrotarget_init_45 > 0

gen MIDs_notlvl1_strong_bin = 0 if MIDs_notlvl1_strong != .
gen MIDs_45_strong_bin = 0 if MIDs_45_strong != .
replace MIDs_notlvl1_strong_bin = 1 if MIDs_notlvl1_strong != . & MIDs_notlvl1_strong > 0
replace MIDs_45_strong_bin = 1 if MIDs_45_strong != . & MIDs_45_strong > 0

label var MIDs_notlvl1_strong_bin "MIDs initiated against weaker petrostates (2+)"
label var MIDs_45_strong_bin "MIDs initiated against weaker petrostates (4+)"

label var MIDs_petrotarget_notlvl1_bin "MIDs initiated against petrostates (2+)"
label var MIDs_petrotarget_45_bin "MIDs initiated against petrostates (4+)"

eststo clear
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear


*Figure 1*
nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_2012=(10(10)110)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD)") graphregion(fcolor(white)) title("")
graph export "Figure1a.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(lag_oilprice=(10(10)110)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), t-1") graphregion(fcolor(white)) title("")
graph export "Figure1b.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_3yrs=(10(10)110)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white)) title("")
graph export "Figure1c.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_5yrs=(10(10)110)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 5-yr avg") graphregion(fcolor(white)) title("")
graph export "Figure1d.jpg", replace quality(100) width(1200) height(800)


*Figure 2*
nbreg MIDs_total_init_notlvl1 c.oilprice_2012##i.revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_2012=(10(10)110) revolutionary=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD)") graphregion(fcolor(white)) legend(order(1 "Non-Revolutionary Gov't" 2 "Revolutionary Gov't")) title("")
graph export "Figure2a.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.lag_oilprice##i.revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(lag_oilprice=(10(10)110) revolutionary=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), t-1") graphregion(fcolor(white)) legend(order(1 "Non-Revolutionary Gov't" 2 "Revolutionary Gov't")) title("")
graph export "Figure2b.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##i.revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_3yrs=(10(10)110) revolutionary=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white)) legend(order(1 "Non-Revolutionary Gov't" 2 "Revolutionary Gov't")) title("")
graph export "Figure2c.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##i.revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_5yrs=(10(10)110) revolutionary=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white)) legend(order(1 "Non-Revolutionary Gov't" 2 "Revolutionary Gov't")) title("")
graph export "Figure2d.jpg", replace quality(100) width(1200) height(800)


*Figure 3*
nbreg MIDs_total_init_notlvl1 c.oilprice_2012##c.rivalry_thompson i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_2012=(10(10)110) rivalry_thompson=(0(2)4)) atmeans
mplotoffset, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD)") graphregion(fcolor(white))  legend(order(1 "No Rivals" 2 "Two Rivals" 3 "Four Rivals")) offset(1) title("")
graph export "Figure3a.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.lag_oilprice##c.rivalry_thompson i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(lag_oilprice=(10(10)110) rivalry_thompson=(0(2)4)) atmeans
mplotoffset, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), t-1") graphregion(fcolor(white))  legend(order(1 "No Rivals" 2 "Two Rivals" 3 "Four Rivals")) offset(1) title("")
graph export "Figure3b.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##c.rivalry_thompson i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_3yrs=(10(10)110) rivalry_thompson=(0(2)4)) atmeans
mplotoffset, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white))  legend(order(1 "No Rivals" 2 "Two Rivals" 3 "Four Rivals")) offset(1) title("")
graph export "Figure3c.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##c.rivalry_thompson i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_5yrs=(10(10)110) rivalry_thompson=(0(2)4)) atmeans
mplotoffset, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 5-yr avg") graphregion(fcolor(white))  legend(order(1 "No Rivals" 2 "Two Rivals" 3 "Four Rivals")) offset(1) title("")
graph export "Figure3d.jpg", replace quality(100) width(1200) height(800)

*Figure 4*
nbreg MIDs_total_init_notlvl1 c.oilprice_2012##i.antigov_dum i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_2012=(10(10)110) antigov_dum=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD)") graphregion(fcolor(white)) legend(order(1 "No Antigov campaign" 2 "Antigov campaign")) title("")
graph export "Figure4a.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.lag_oilprice##i.antigov_dum i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(lag_oilprice=(10(10)110) antigov_dum=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), t-1") graphregion(fcolor(white)) legend(order(1 "No Antigov campaign" 2 "Antigov campaign")) title("")
graph export "Figure4b.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##i.antigov_dum i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_3yrs=(10(10)110) antigov_dum=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white)) legend(order(1 "No Antigov campaign" 2 "Antigov campaign")) title("")
graph export "Figure4c.jpg", replace quality(100) width(1200) height(800)

nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##i.antigov_dum i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
margins, at(oilprice_5yrs=(10(10)110) antigov_dum=(0 1)) atmeans
marginsplot, ytitle("Predicted Number of MIDs (2+)")  xtitle("Oil price (USD), 3-yr avg") graphregion(fcolor(white)) legend(order(1 "No Antigov campaign" 2 "Antigov campaign")) title("")
graph export "Figure4d.jpg", replace quality(100) width(1200) height(800)



*Figure 5*
twoway (scatter petroMIDs_proportion oilprice_2012) (lfitci petroMIDs_proportion oilprice_2012) if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., legend(off) ytitle("Proportion of MIDs initiated against petrostates")  xtitle("Oil price (USD)") graphregion(fcolor(white))
graph export "Figure5.jpg", replace quality(100) width(1200) height(800)


*Table A1*
 estpost summarize MIDs_total_init_notlvl1 MIDs_init_45 oilprice_2012 gdp_2012 gdppc_2012 polity2 defense if  oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != .
* esttab using sumstats.rtf, cells("count mean sd min max") label nogaps

 
 *Table A2*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs  L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs  L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs  L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs  L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs  L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense L1.oilproduction_3yrs L1.globalMIDs_hostlev_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A3*
eststo clear
eststo: nbreg MIDs_notlvl1_all oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if  oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notlvl1_all lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notlvl1_all oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notlvl1_all oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_45_all oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_45_all lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_45_all oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_45_all oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != ., cluster(id)
eststo clear


*Table A4*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 20 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear


*Table A5*

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2  if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice  L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2  if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs  L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs  L1.gdp_2012 i.countrydecade L1.gdppc_2012 L1.polity2  if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A6*
eststo clear
eststo: nbreg MIDs_notinit_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notinit_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notinit_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_notinit_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: ologit  MIDs_notinit_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: ologit  MIDs_notinit_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: ologit  MIDs_notinit_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: ologit  MIDs_notinit_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear




*Table A7*

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_2012##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.lag_oilprice##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_2012##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.lag_oilprice##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_3yrs##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_5yrs##c.oilproduction_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo clear


*Table A8*

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_2012##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.lag_oilprice##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_2012##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_init_45 c.lag_oilprice##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_3yrs##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_5yrs##c.netoilexports_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilexports_pergdp_country > 10 & oilexports_pergdp_country != . & ccode != . & year > 1979, cluster(id)
eststo clear

*Table A9*

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_2012##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.lag_oilprice##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_3yrs##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . , cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 c.oilprice_5yrs##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_2012##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.lag_oilprice##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_3yrs##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 c.oilprice_5yrs##c.oilproduction_country L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear


*Table A10*
eststo clear
eststo: logit MIDs_notlvl1_strong_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_strong_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_strong_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_strong_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_strong_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_strong_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_strong_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_strong_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A11*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(year)
eststo clear

*Table A12*
*gen log_gdppc = log(gdppc_2012*1000)
*gen log_pop = log(population)
gen coldwar = 0
replace coldwar = 1 if year < 1990
gen MIDs_total_init_notlvl1_dum = 0 if MIDs_total_init_notlvl1 != .
replace MIDs_total_init_notlvl1_dum = 1 if MIDs_total_init_notlvl1 > 0 & MIDs_total_init_notlvl1 != .

by id (year), sort: gen spell = (MIDs_total_init_notlvl1_dum != 0)
by id (year): replace spell = sum(spell)
by id spell (year), sort: gen wanted = _n-1 if spell > 0
by id spell (year): replace wanted = _n if spell == 0
order country year wanted spell MIDs_total_init_notlvl1_dum
rename wanted peaceyears
gen peaceyears2 = peaceyears^2
gen peaceyears3 = peaceyears^3
xtset id year

label var log_pop "Population (log)"
label var log_gdppc "GDPpc (log)"
label var coldwar "Cold War"
label var peaceyears "Peace years"
label var peaceyears2 "Peace years2"
label var peaceyears3 "Peace years3"

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & year < 2002, cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & year < 2002, cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.log_pop L1.log_gdppc coldwar L1.polity2 L1.peaceyears L1.peaceyears2 L1.peaceyears3 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.log_pop L1.log_gdppc coldwar L1.polity2 L1.peaceyears L1.peaceyears2 L1.peaceyears3 if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp > 10 & oilrentspergdp != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp > 10 & oilrentspergdp != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.log_pop L1.log_gdppc coldwar L1.polity2 L1.peaceyears L1.peaceyears2 L1.peaceyears3 if oilrentspergdp > 10 & oilrentspergdp != . & ccode != . & year < 2002, cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.log_pop L1.log_gdppc coldwar L1.polity2 L1.peaceyears L1.peaceyears2 L1.peaceyears3 if oilrentspergdp > 10 & oilrentspergdp != . & ccode != . & year < 2002, cluster(id)
eststo clear


*Table A13*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear


*Table A14*

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs revolutionary i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A15*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != . & revolutionary != ., cluster(id)
eststo clear

*Table A16*
gen bordering = .
gen bordering_petro = .
replace bordering = 6 if country=="Algeria"
replace bordering_petro = 1 if country=="Algeria"
replace bordering = 3 if country=="Angola"
replace bordering_petro = 1 if country=="Angola"
replace bordering = 4 if country=="Azerbaijan"
replace bordering_petro = 1 if country=="Azerbaijan"
replace bordering = 1 if country=="Bahrain"
replace bordering_petro = 0 if country=="Bahrain"
replace bordering = 0 if country=="Brunei Darussalam"
replace bordering_petro = 0 if country=="Brunei Darussalam"
replace bordering = 4 if country=="Congo, Rep."
replace bordering_petro = 2 if country=="Congo, Rep."
replace bordering = 3 if country=="Egypt, Arab Rep."
replace bordering_petro = 1 if country=="Egypt, Arab Rep."
replace bordering = 2 if country=="Equatorial Guinea"
replace bordering_petro = 1 if country=="Equatorial Guinea"
replace bordering = 3 if country=="Gabon"
replace bordering_petro = 2 if country=="Gabon"
replace bordering = 6 if country=="Iran, Islamic Rep."
replace bordering_petro = 3 if country=="Iran, Islamic Rep."
replace bordering = 6 if country=="Iraq"
replace bordering_petro = 3 if country=="Iraq"
replace bordering = 5 if country=="Kazakhstan"
replace bordering_petro = 1 if country=="Kazakhstan"
replace bordering = 2 if country=="Kuwait"
replace bordering_petro = 2 if country=="Kuwait"
replace bordering = 5 if country=="Libya"
replace bordering_petro = 2 if country=="Libya"
replace bordering = 4 if country=="Nigeria"
replace bordering_petro = 0 if country=="Nigeria"
replace bordering = 3 if country=="Oman"
replace bordering_petro = 3 if country=="Oman"
replace bordering = 1 if country=="Qatar"
replace bordering_petro = 2 if country=="Qatar"
replace bordering = 7 if country=="Saudi Arabia"
replace bordering_petro = 7 if country=="Saudi Arabia"
replace bordering = 6 if country=="South Sudan"
replace bordering_petro = 0 if country=="South Sudan"
replace bordering = 1 if country=="Timor-Leste"
replace bordering_petro = 0 if country=="Timor-Leste"
replace bordering = 0 if country=="Trinidad and Tobago"
replace bordering_petro = 0 if country=="Trinidad and Tobago"
replace bordering = 4 if country=="Turkmenistan"
replace bordering_petro = 2 if country=="Turkmenistan"
replace bordering = 2 if country=="United Arab Emirates"
replace bordering_petro = 3 if country=="United Arab Emirates"
replace bordering = 3 if country=="Venezuela, RB"
replace bordering_petro = 0 if country=="Venezuela, RB"
replace bordering = 2 if country=="Yemen, Rep."
replace bordering_petro = 2 if country=="Yemen, Rep."
label var bordering_petro "Bordering petrostates"

eststo clear
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense bordering_petro if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A17*
gen iraniraqwar = 0
replace iraniraqwar = 1 if year > 1978 & year < 1989 & country=="Iran, Islamic Rep."
replace iraniraqwar = 1 if year > 1978 & year < 1989 & country=="Iraq"
label var iraniraqwar "Iran-Iraq War"
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_2012 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 lag_oilprice i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A18*

eststo clear
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_petrotarget_45_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense iraniraqwar if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A19*
gen rp = (provenreserves*1000000000) / (oilproduction_thousandbarrelsday*365000)
gen lag_rp = L1.rp
gen rp_5yrs = (rp + L1.rp + L2.rp + L3.rp + L4.rp) / 5
gen rp_3yrs = (rp + L1.rp + L2.rp) / 3

label var rp "R/P ratio"
label var lag_rp "R/P ratio (t-1)"
label var rp_3yrs "R/P ratio (3-yr avg)"
label var rp_5yrs "R/P ratio (5-yr avg)"

eststo clear
eststo: nbreg MIDs_total_init_notlvl1 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense lag_rp if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp_5yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense lag_rp if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp_3yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense rp_5yrs if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear


*Table A20*
label var MIDs_notlvl1_bin "MIDs (2+), binary"
label var MIDs_45_bin "MIDs (4+), binary"

eststo clear
eststo: logit MIDs_notlvl1_bin oilprice_2012 L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin lag_oilprice L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_2012 L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  lag_oilprice L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_3yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_5yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A21*
eststo clear
eststo: reg MIDs_notlvl1_bin oilprice_2012 L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin lag_oilprice L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_2012 L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  lag_oilprice L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_3yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_5yrs L1.gdp_2012 i.id i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A22*
eststo clear
eststo: logit MIDs_notlvl1_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: logit MIDs_45_bin  oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A23*
eststo clear
eststo: reg MIDs_notlvl1_bin oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_notlvl1_bin oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_2012 L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  lag_oilprice L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_3yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: reg MIDs_45_bin  oilprice_5yrs L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear

*Table A24*
eststo clear
eststo: nbreg MIDs_total_init_notlvl1 oilprice_chg_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_total_init_notlvl1 oilprice_chg_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_chg_3yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo: nbreg MIDs_init_45 oilprice_chg_5yrs i.id L1.gdp_2012 i.decade L1.gdppc_2012 L1.polity2 L1.defense if oilrentspergdp_country > 10 & oilrentspergdp_country != . & ccode != ., cluster(id)
eststo clear



